<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="description" content="">
    <meta name="HandheldFriendly" content="True">
    <meta name="MobileOptimized" content="320">
    <meta name="viewport" content="width=device-width, initial-scale=1, minimal-ui, user-scalable=no">
    <meta http-equiv="cleartype" content="on">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="/assets/restaurant/css/style.css">
</head>
<body>
<div class="wraper">
    <header class="text-center font-white font-36">
        <a href="#" class="back"><img src="/assets/restaurant/images/back.png" alt=""></a>
        上菜
        <a href="#" class="right"><img src="/assets/restaurant/images/Refresh.png" alt="" onclick="window.location.reload();"></a>
    </header>
    <div class="tb-mode search">
        <div class="tb-cell input">
            <input type="text" id="good_tj" class="font-gray2 font-28 " placeholder="请输入菜名 / 桌号" value="{BEESCRM:$good_tj}">
        </div>
        <a href="#" class="search_text font-28 font-white text-center tb-cell soso">搜索</a>
    </div>
    <div class="main">
        <div class="padding-20 js_tab">
            <div class="tab font-28 font-gray2 text-center tb-mode">
                <div class='tab-list tb-cell <if condition="$type eq -1"> active</if>'>全部</div>
                <div class='tab-list tb-cell <if condition="$type eq 0"> active</if>'>未上菜</div>
                <div class='tab-list tb-cell <if condition="$type eq 1"> active</if>'>未取菜</div>
                <div class='tab-list tb-cell <if condition="$type eq 2"> active</if>'>已取菜</div>
            </div>
        </div>
        <div class="contain clearfix">

            <foreach name="goods" item="vo">
                <div class="padding-20 half pull-left">
                    <div class="tb-mode ">
                        <div class="imga tb-cell">
                            <img src="{BEESCRM:$vo['goods_logo']}" alt="">
                        </div>
                        <div class=" tb-cell padding-l40">
                            <div class="font-48">
                                {BEESCRM:$vo['goods_name']}<span class="padding-l40">{BEESCRM:$vo['order_num']}号</span>
                            </div>
                            <div class="font-28 font-gray2">下单时间：{BEESCRM:$vo['create_time']}</div>
                        </div>
                        <if condition="$vo['goods_status'] eq 0">
                            <a href="#" class="font-white font-32 tb-cell btn ">
                                <div class="txt text-center js_btn" data-style="1" data-ogid="{BEESCRM:$vo['og_id']}">上菜</div>
                            </a>
                         <elseif condition="$vo['goods_status'] eq 1"/>
                            <a href="#" class="font-white font-32 tb-cell btn">
                                <div class="txt text-center js_btn" data-style="2" data-ogid="{BEESCRM:$vo['og_id']}">取菜</div>
                            </a>
                         <else/>
                            <a href="#" class="font-32 tb-cell btn ">
                                <div class="txt text-center Visited">已取菜</div>
                            </a>

                        </if>
                    </div>
                </div>
            </foreach>

        </div>
        <!--<div class="contain hide">-->
            <!--<div class="padding-20">-->
                <!--<div class=" tb-mode">-->
                    <!--<div class="imga tb-cell">-->
                        <!--<img src="/assets/restaurant/images/pic01.png" alt="">-->
                    <!--</div>-->
                    <!--<div class=" tb-cell padding-l40">-->
                        <!--<div class="font-48">-->
                            <!--青椒肉丝<span class="padding-l40">5号</span>-->
                        <!--</div>-->
                        <!--<div class="font-28 font-gray2">下单时间：2017-08-03 10:00</div>-->
                    <!--</div>-->
                    <!--<a href="#" class="font-white font-32 tb-cell btn">-->
                        <!--<div class="txt text-center js_btn">上菜</div>-->
                    <!--</a>-->
                <!--</div>-->
            <!--</div>-->
            <!--<div class="padding-20">-->
                <!--<div class=" tb-mode">-->
                    <!--<div class="imga tb-cell">-->
                        <!--<img src="images/pic01.png" alt="">-->
                    <!--</div>-->
                    <!--<div class=" tb-cell padding-l40">-->
                        <!--<div class="font-48">-->
                            <!--青椒肉丝<span class="padding-l40">5号</span>-->
                        <!--</div>-->
                        <!--<div class="font-28 font-gray2">下单时间：2017-08-03 10:00</div>-->
                    <!--</div>-->
                    <!--<a href="#" class="font-white font-32 tb-cell btn">-->
                        <!--<div class="txt text-center js_btn">取菜</div>-->
                    <!--</a>-->
                <!--</div>-->
            <!--</div>-->
        <!--</div>-->
        <!--<div class="contain hide">-->
            <!--<div class="padding-20">-->
                <!--<div class=" tb-mode">-->
                    <!--<div class="imga tb-cell">-->
                        <!--<img src="images/pic01.png" alt="">-->
                    <!--</div>-->
                    <!--<div class=" tb-cell padding-l40">-->
                        <!--<div class="font-48">-->
                            <!--青椒肉丝<span class="padding-l40">5号</span>-->
                        <!--</div>-->
                        <!--<div class="font-28 font-gray2">下单时间：2017-08-03 10:00</div>-->
                    <!--</div>-->
                    <!--<a href="#" class="font-32 tb-cell btn ">-->
                        <!--<div class="txt text-center Visited">已取菜</div>-->
                    <!--</a>-->
                <!--</div>-->
            <!--</div>-->
        <!--</div>-->
    </div>
    <div class="pop-box hide">
        <div class="pop-hint">
            <div class="font-40 text-center hint-txt"></div>
            <div class="tb-mode border-top">
                <a href="#" class="pop-btn font-32 tb-cell text-center">取消</a>
                <a href="#" class="pop-btn font-32 tb-cell text-center font-blue">确定</a>
            </div>
        </div>
    </div>


</div>
</body>
<script src="/assets/restaurant/js/jquery-2.1.0.min.js"></script>
<script>
    var og_id;
    var type;

    $(function () {
        var window_height=$(window).height();
        var header_height=$('header').outerHeight(true);
        var search_height=$('.search').outerHeight(true);
        var tab_height=$('.js_tab').outerHeight(true);
        $('.contain').css('height',window_height-header_height-search_height-tab_height);

        $('.tab').on('click', '.tab-list', function () {
            var idx = $(this).index() -1;
            window.location.href="/restaurant/ZduScreen/padindex?restaurant_id={BEESCRM:$restaurant_id}&type="+idx+"&good_tj={BEESCRM:$good_tj}";
//            $('.contain').eq(idx).removeClass('hide').siblings('.contain').addClass('hide');
//            $(this).addClass('active').siblings('.tab-list').removeClass('active');
        })

        $('.pop-box').on('click','.pop-btn',function () {
            $('.pop-box').addClass('hide');
        })



        $('.js_btn').click(function () {
            var texts='确定'+$.trim($(this).html())+'？';
            type = $(this).attr('data-style');
            og_id = $(this).attr('data-ogid');
            $('.pop-box').find('.hint-txt').text(texts);
            $('.pop-box').removeClass('hide');
            return false;
        })

        $('.font-blue').click(function () {
            $.ajax({
                type: "post",
                url: "/restaurant/ZduScreen/doType",
                data: {
                    og_id: og_id,
                    type: type
                },
                dataType: "json",

                success:function(res){
                    if(res==1){
                        alert('操作成功');

                    }else{
                        alert('操作失败')
                    }
                    window.location.reload();
                }
            })
        })

        $('.soso').click(function () {
            var good_tj = $('#good_tj').val();
            window.location.href="/restaurant/ZduScreen/padindex?restaurant_id={BEESCRM:$restaurant_id}&good_tj="+good_tj+"&type={BEESCRM:$type}";
        })

    });

</script>

<script>
    var wAlert = window.alert;
    window.alert = function (message) {
        try {
            var iframe = document.createElement("IFRAME");
            iframe.style.display = "none";
            iframe.setAttribute("src", 'data:text/plain,');
            document.documentElement.appendChild(iframe);
            var alertFrame = window.frames[0];
            var iwindow = alertFrame.window;
            if (iwindow == undefined) {
                iwindow = alertFrame.contentWindow;
            }
            iwindow.alert(message);
            iframe.parentNode.removeChild(iframe);
        }
        catch (exc) {
            return wAlert(message);
        }
    }

</script>

